<template>
  <div flex flex-a-c flex-j-sb>
    <div flex flex-a-c>

      <image w-100rpx h-100rpx rounded-100 :src="storeInfo.storeLogo || configs.logo" />

      <div ml-20rpx>
        <div mb-10rpx>{{ storeInfo.storeName }}</div>
        <div text-24rpx color-warmGray>
          <span mr-20rpx>{{ storeInfo.collectionNum || 0 }}人关注</span>
          <span>{{ storeInfo.goodsNum || 0 }}件商品</span>
        </div>
      </div>
    </div>
    <nut-button @click="$navigateTo('/pages/goods/store/detail?id=' + props.id)" type="primary">进店逛逛</nut-button>
  </div>
</template>

<script setup lang="ts">
import { getStoreDetail } from '@/api/goods';
import configs from '@/config/config';

const storeInfo = ref<any>('')
const props = defineProps({
  id: {
    type: String,
    default: ''
  }
})
async function fetchStoreDetail() {
  const storeId = props.id || ''
  if (storeId) {
    const res = await getStoreDetail(storeId)
    if (res.data.success) {
      storeInfo.value = res.data.result
    }
  }
}

onMounted(() => {
  fetchStoreDetail()
})

</script>

<style scoped></style>
